import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/home/index.vue";

const routes = [
  {
    path: "/logo",
    name: "logo",
    hidden: true,
    meta: {
      title: "登录",
    },
    component: () => import("../views/acount/login.vue"),
  },
  {
    path: "/forget",
    name: "forget",
    hidden: true,
    meta: {
      title: "忘记密码",
    },
    component: () => import("../views/acount/forget.vue"),
  },
  {
    path: "/register",
    name: "register",
    hidden: true,
    meta: {
      title: "注册",
    },
    component: () => import("../views/acount/register.vue"),
  },
  {
    path: "/index",
    name: "Index",
    meta: {
      title: "首页",
    },
    component: HomeView,
    children: [
      {
        path: "dashboard",
        name: "dashboard",
        meta: {
          title: "首页",
        },
        component: () => import("../views/dashboard/index.vue"),
      },
    ],
  },
  {
    path: "/adminIndex",
    name: "AdminIndex",
    meta: {
      title: "管理总统",
    },
    component: HomeView,
    children: [
      {
        path: "/userlist",
        name: "userlist",
        meta: {
          title: "用户列表",
        },
        component: () => import("../views/admin/index.vue"),
      },
      {
        path: "/role",
        name: "role",
        meta: {
          title: "用户路由",
        },
        component: () => import("../views/admin/role.vue"),
      },
    ],
  },
  {
    path: "/news",
    name: "News",
    meta: {
      title: "新闻管理",
    },
    //redirect: "/newlist",
    component: HomeView,
    children: [
      {
        path: "/newlist",
        name: "newlist",
        meta: {
          title: "新闻列表",
        },
        component: () => import("../views/news/index.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
